const esbuild = require('esbuild');

const vueCompilerModules = [
    'velocityjs', 'dustjs-linkedin', 'atpl', 'liquor', 'twig', 'ejs',
    'eco', 'jazz', 'jqtpl', 'hamljs', 'hamlet', 'whiskers', 'haml-coffee',
    'hogan.js', 'templayed', 'handlebars', 'walrus', 'mustache', 'just',
    'ect', 'mote', 'toffee', 'dot', 'bracket-template', 'ractive',
    'htmling', 'babel-core', 'plates', 'react-dom/server', 'vash', 'slm',
    'marko', 'teacup/lib/express', 'coffee-script', 'squirrelly', 'twing'
];

esbuild.build({
    entryPoints: ['src/extension.ts'],
    bundle: true,
    outfile: 'dist/extension.js',
    external: ['vscode', 'd3', ...vueCompilerModules], // Exclude vscode, d3, and optional vue modules
    format: 'cjs',
    platform: 'node',
    sourcemap: true,
    minify: true,
}).catch(() => {
    console.error('Build failed.');
    process.exit(1);
});

console.log('Build finished successfully.'); 